package work20240808.work7;

import work20240808.work5.Lock;

public class num extends Thread{
    private int lenth = 52;

    @Override
    public void run() {
        synchronized (lock.o) {
            for (int i = 1; i <= lenth; i++) {
                while(lock.flag){
                    try {
                        lock.o.wait();
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
                System.out.print(i + " ");
                if(i % 2 == 0){
                    lock.flag = true;
                    lock.o.notifyAll();
                }
            }
        }
    }
}
